package com.flysh.host.service;

import java.util.List;

import com.flysh.host.dao.UserDao;
import com.flysh.host.dao.UserDaoImpl;
import com.flysh.host.model.User;
import com.flysh.host.util.JSONUtil;

public class UserManagerServiceImpl implements UserManagerService{
	
	private UserDao userDao = new UserDaoImpl();
	
	public User login(User user) {
		User u = userDao.login(user);
		return u;
	}

	public List<User> getAllUsers() {
		return userDao.getAllUser();
	}

	public String getAllUsers(List<User> list) {
		return JSONUtil.getUserJSON(list);
	}

	@Override
	public int add(User user) {
		// TODO Auto-generated method stub
		return userDao.add(user);
	}

	@Override
	public int remove(Long id) {
		// TODO Auto-generated method stub
		return userDao.remove(id);
	}

	@Override
	public int update(Long id, User newUser) {
		// TODO Auto-generated method stub
		return userDao.update(id, newUser);
	}

	@Override
	public User getUser(Long id) {
		// TODO Auto-generated method stub
		return userDao.getUser(id);
	}

	@Override
	public List<User> getAllUser() {
		// TODO Auto-generated method stub
		return userDao.getAllUser();
	}

	

}
